<template>
	<view class="bgw boxHeight">
		<image class="login-bg" src="/static/images/login-bg.jpg" mode="widthFix"></image>
		<view style="position: relative;">
			<u-gap height="100"></u-gap>
			<image class="logo-img" src="/static/images/logo.jpg" mode="widthFix"></image>
			<view class="text-center" style="font-size: 46upx;" v-if="sessionInfo.cus_loc_id">
				{{sessionInfo.cus_loc_id[1]}}
			</view>
			<u-gap height="100"></u-gap>
			<view class="wrapper">
				<u-button type="primary" size="large" text="去点餐" @click="orderDish" :disabled="!sessionInfo.company_id"></u-button>
				<u-gap height="15"></u-gap>
				<view class="text-gray text-center" v-if="sessionInfo.company_id">
					{{sessionInfo.company_id[1]}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		session_info
	} from '@/common/api.js';
	export default {
		data() {
			return {
				sessionInfo:{},
				isLogin:false
			}
		},
		watch: {

		},
		methods: {
			orderDish(){
				this.navLogin('pages/addOrder/addOrder');
			},
			async getData() {
				uni.showLoading({
					title: '加载中'
				});
				try{
					await this.get_session_info();
					this.sessionInfo = this.$store.getters.get_sessionInfo;
				}catch(e){
					uni.$u.toast(e);
				}
				uni.hideLoading();
				// session_info().then((res) => {
				// 	this.$store.commit('set_sessionInfo',res);
				// 	this.sessionInfo = res;
				// }).catch(() => {
				// 	uni.hideLoading();
				// }).finally(() => {
				// 	uni.hideLoading();
				// 	uni.stopPullDownRefresh();
				// })
			}
		},
		onLoad() {
			this.getData();
		},
		onShow() {
			try{
				this.isLogin = this.$store.getters.get_isLogin;
			}catch(e){
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	page,body {
		background-color: #ffffff;
	}
	.boxHeight{
		height: 100vh;
	}

	.wrapper {
		padding: 0 74upx;
	}

	.logo-img {
		display: block;
		margin: 0 auto 30upx;
		width: 140upx;
	}

	.text-link {
		text-decoration: underline;
		color: #1373AB;
	}
	.login-bg{
		position: fixed;
		bottom: 0;
		left:0;
		right:0;
		width: 750upx;
	}
</style>